#ifndef I2C_H_
#define I2C_H_

#ifdef __USE_CMSIS
#include "LPC17xx.h"
#endif

// MACROS I2C1
#define I2C1_CLR_INT_FLAG() 		LPC_I2C1->I2CONCLR = 0x00000008   // Clear flag
#define I2C1_ENABLE()          		LPC_I2C1->I2CONSET = 0x00000040   // Enable I2C module
#define I2C1_DISABLE()         		LPC_I2C1->I2CONCLR = 0x00000040   // Disable I2C module (use as regular I/O pins)
#define I2C1_START_TX()				LPC_I2C1->I2CONSET = 0x00000020   // Sends the start command
#define I2C1_KEEP_REPEAT_START()  	LPC_I2C1->I2CONCLR = 0x00000020   // Keep a repeated start from happening
#define I2C1_STOP_TX()         		LPC_I2C1->I2CONSET = 0x00000010   // Sends a stop command
#define I2C1_ACK()             		LPC_I2C1->I2CONSET = 0x00000004   // Sends an acknowledge
#define I2C1_NACK()            		LPC_I2C1->I2CONCLR = 0x00000004   // Sends a Not acknowledged

void I2C1_Init(void);
void I2C1_IRQHandler(void);

#endif /* I2C_H_ */
